/*
 * @Author: szx
 * @Date: 2021-11-10 17:12:59
 * @LastEditTime: 2021-11-10 17:20:30
 * @Description:
 * @FilePath: \leetcode\400-499\495\495.cpp
 */
#include <iostream>
#include <vector>
using namespace std;
class Solution {
   public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
        int sum = 0;
        for (int i = 1; i < timeSeries.size(); i++) {
            if (timeSeries[i] - timeSeries[i - 1] < duration) {
                sum += timeSeries[i] - timeSeries[i - 1];
            } else {
                sum += duration;
            }
        }
        return sum + duration;
    }
};
int main() { return 0; }